home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
net
/
parnet-3.2
/
extras
/
parpc
/
pcfiles
/
talk.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-09
|
1KB
|
65 lines
/* TALK.C: To test sending from PC to amiga
* 1. on your amiga, type: machaddr 4
* listen 4
* 2. on the PC, type: talk
*/
#include <stdio.h>
#include <signal.h>
#include "pardev.h"
typedef struct {
int length;
unsigned char buffer[255];
} Data;
Data Dat[2];
int Trigger=0;
void ParAbort(void)
{
par_stop();
printf("Aborted.\n");
exit(1);
}
void parint(void)
{
unsigned char buffer[255];
int Length;
printf("i\n");
if (ParDataReady())
{
Length=ParRead(buffer,255);
if (Length > 0)
{
memcpy(Dat[Trigger].buffer,buffer,Length);
Dat[Trigger].length=Length;
Trigger+=1;
}
}
}
main(int argc,char **argv)
{
int Ready;
char buffer[255]="0000000012345678\0\0"; /* just something to fill it */
par_init(1,0x0278);
/* signal(SIGINT,ParAbort);
signal(SIGABRT,ParAbort);
*/
ctrlbrk(ParAbort);
buffer[0]=0;
buffer[1]=4; /* port = 4 */
buffer[2]=0;
buffer[3]=0; /* checksum = 0 */
buffer[4]=0;
buffer[5]=0;
buffer[6]=0;
buffer[7]=8; /* length = 8 */
parwrite(4,buffer,16); /* just a 'single shot' test */
}